<template>
  <div>
    <h3>用户登录</h3>
    <hr />
    <div>
      <input v-model="username" />
    </div>
    <div>
      <input v-model="password" />
    </div>
    <div>
      <button @click="login">进入系统</button>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      username: 'admin',
      password: 'admin'
    }
  },
  methods: {
    login() {
      if (this.username === 'admin') {
        localStorage.setItem('token','fewfewlfewlkfewlkfelfew')
        // this.$router.replace('/admin/dashboard')
        this.$router.replace('/admin')
      } else {
        alert('登录失败')
      }
    }
  }
}
</script>

<style lang="scss" scoped></style>
